package com.example.cms.service.Impl;

import java.util.List;

import com.example.cms.pojo.Mesagge;
import com.example.cms.pojo.QueryPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.example.cms.dao.OrderDao;
import com.example.cms.entity.Order;
import com.example.cms.service.OrderService;

@Service("OrderService")
@Transactional
public class OrderServiceImpl implements OrderService{

	@Autowired
	private OrderDao orderDao;

	@Override
	public List<Order> findOrdePage(Mesagge mesagge,QueryPage queryPage) {
		int i=orderDao.getOrdersNum();
		queryPage.setPageSize(4);
		mesagge.setMesCode(i);
		mesagge.setPageSize(queryPage.getPageSize());
		return orderDao.getAllOrders(queryPage);
	}

	/**
	 * @Author Sunbird
	 * @Description 查询所有订单信息
	 * @Date  2018/12/13
	 * @Param
	 * @return
	 **/
//	@Override
//	public List<Order> getAllorderS(Mesagge mesagge) {
//		int i=orderDao.getOrdersNum();
//		mesagge.setMesCode(i);//设置有多少条数
//		// TODO Auto-generated method stub
//		return orderDao.getAllOrders();
//	}

	@Override
	public Integer insertOrder(Order order) {
		return orderDao.insertOrder(order);
	}

	@Override
	public Integer deletOrder(int OrderId) {
		return orderDao.deleteOrder(OrderId);
	}

	@Override
	public Integer updateOrder(Order order) {
		return orderDao.updaeOrder(order);
	}

}
